
<div class="container">

  <ul class="list-group list-group-flush">
    {{range $index, $item := .Films}} 
    <li class="list-group-item">
      <a href="{{ $item.url }}" target="_blank" class="text-dark">
        {{ $item.title }}
      </a>
      <br />
      <button type="button" onclick="popupQRCode('{{$index}}','{{ $item.url }}')" class="btn btn-outline-info btn-sm mt-2">磁力链接</button>
      <h5 id="f{{ $index }}" style="margin-top: 20px; display:none;"></h5>
    </li>
    {{end}}
  </ul>
  
</div>


<script>
  function popupQRCode(id, url){
      $.post("/film/magnet", {url: url}, function(data){
          $("#f"+ id).css("display","block").text(data.magnet);
      })
  }
</script>